package org.poptest.populate.provider;

import org.poptest.populate.provider.impl.*;

import java.util.HashMap;
import java.util.Map;

/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * @author Alan Roche
 *         Date: 21/02/11
 *         Time: 22:15
 */
public class MapProviderFactory implements  ProviderFactory{
    private final Map<Class<?>, Class<? extends ValueProvider>> providersMap =
            new HashMap<Class<?>, Class<? extends ValueProvider>>();

    public MapProviderFactory() {
        loadProviders();
    }

    private void loadProviders() {
        providersMap.put(Integer.class, IntegerProvider.class);
        providersMap.put(int.class, IntegerProvider.class);
        providersMap.put(Float.class, FloatProvider.class);
        providersMap.put(float.class, FloatProvider.class);
        providersMap.put(Double.class, DoubleProvider.class);
        providersMap.put(double.class, DoubleProvider.class);
        providersMap.put(Long.class, LongProvider.class);
        providersMap.put(long.class, LongProvider.class);
        providersMap.put(Short.class, ShortProvider.class);
        providersMap.put(short.class, ShortProvider.class);
        providersMap.put(Character.class, CharProvider.class);
        providersMap.put(char.class, CharProvider.class);
        providersMap.put(Byte.class, ByteProvider.class);
        providersMap.put(byte.class, ByteProvider.class);
    }

    public ValueProvider create(Class<?> clazz) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    public Map<Class<?>, Class<? extends ValueProvider>> getProvidersMap() {
        return providersMap;
    }
}
